feat: add status filter as array (CM-1236) - #4235
Merged
Merged
Conversation
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the OSSPREY “package scatter” public API to accept multiple stewardship statuses in a single request (while preserving compatibility for single status values by normalizing them to an array). The status filtering is implemented end-to-end: request validation/normalization in the API handler and array-based filtering in the data-access query.
Changes:
- Update scatter query parsing to normalize
statusinto an array (supports repeated params and comma-separated values) and validate against the known stewardship status enum. - Update
listPackagesForScatterto acceptstatus?: string[]and apply the filter vias.status = ANY($(status)::text[]), while keeping the specialunassignedbehavior to includes.id IS NULL.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| services/libs/data-access-layer/src/osspckgs/api.ts | Changes scatter query filtering from single status to status[] using ANY(...), preserving unassigned semantics. |
| backend/src/api/public/v1/ossprey/packageScatter.ts | Adds normalizeToArray + Zod preprocessing so the public endpoint accepts multiple statuses reliably and validates them. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
filter status by array
Type of change
Note
Low Risk
Read-only scatter query filtering in a public API; single-value queries still work via normalization.
Overview
The package scatter endpoint now accepts multiple stewardship statuses in one request instead of a single
statusvalue.Query parsing adds
normalizeToArray, so clients can pass repeated params, a comma-separated string, or a lone value; validation requires a non-empty array of known status enums whenstatusis present.listPackagesForScatterbuilds as.status = ANY(...)filter and still treatsunassignedas including packages with no stewardship row (s.id IS NULL) when that value is in the list.Reviewed by Cursor Bugbot for commit 37d80d9. Bugbot is set up for automated code reviews on this repo. Configure here.